Current Version: 1.0
TVirtualPropertyTree is a
descendant of TvirtualStringTree (by Mike Lischke), which simulates Microsoft
Visual Studio property tree, which can usually be seen in the right-bottom
part of the screen. Users of Delphi should be familiar with the concept, as it
is exploited in Delphi’s Object Inspector. At any rate, I think
Microsoft’s implementation looks much better, so I followed it.
TVirtualPropertyTree’s interface is as identical to Microsoft’s property tree as I could make it.
All the functionality of TVirtualPropertyTree is derived from this single record :
TField = record
Name : string;
Category : string;
Data : pointer;
DataType : TDataType;
//
dtCombo support
ComboData : array of
string;
//
dtInteger/dtExtended support
MinValue,
MaxValue : integer;
end;
Explanation of the various
fields:
|
Name: |
The name
of the field; displayed in the left part of the tree. |
|
Category: |
Fields
are arranged in Categories (such as “DDE”, “Visual”); this is the name of the
Category this field belongs to. |
|
Data: |
The tree
directly modifies variables when the user changes them; this is a pointer to
that data. The type of the pointed-to data is determined by the next member, DataType. |
|
DataType: |
One of
the following value : dtInteger,
dtString, dtCombo, dtColor, dtExtended. This member defines what type Data
should point to. For example, if DataType
= dtString, Data should have been set to something like Data := @s;, where s is declared as string. |
|
ComboData: |
If DataType is dtCombo, ComboData
should be filled with the values that will be displayed in the ComboBox that
will be created for this field. Data must be pointing to an integer, which will receive the index of the selected item in the
ComboBox. |
|
MinValue, MaxValue: |
If DataType is dtInteger or dtExtended,
these two members define the maximal and minimal values that the tree will allow
the user to enter. |
Various types for DataType:
dtInteger: Data
points to an integer variable; see MinValue and MaxValue
(PInteger).
dtString: Data
points to a string variable (PString).
dtCombo: Data
points to an integer variable; see ComboData (PInteger).
dtColor: Data
points to a TColor variable (PColor).
dtExtended: Data
points to an extended variable; see MinValue and MaxValue
(PExtended).
To use the tree, the first thing to do is to create field
entries in the tree’s Fields public field; for an example, see the demo project
in the package. Then all fields must be filled in according to their DataType member.
Note: each
field’s Data must be pointing to a valid, correct
variable.
This whole package is governed by the Mozilla Public License 1.1 (MPL 1.1), which can be easily obtained from http://www.mozilla.org/MPL/MPL-1.1.html .